package cn.pdx.elec.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.pdx.elec.container.ServiceProvider;
import cn.pdx.elec.service.ElecUserService;

@SuppressWarnings("serial")
public class CheckLogonName extends HttpServlet {

	
	ElecUserService elecUserService=(ElecUserService) ServiceProvider.getService(ElecUserService.SERVICE_NAME);
	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		
		String logonName=request.getParameter("logonName");
		
		/**
		 * checkflag:判断当前登录名在数据库中是否存在的标识
		 * checkflag=1：如果值为1,说明当前登录名在数据库有重复记录,则不能进行保存
		 * checkflag=2：如果值为2,说明当前登录名在数据库没有重复记录,可以进行保存
		 * @Create Date:2013-4-7(创建日期)
		 */
		String checkflag=elecUserService.checkLogonName(logonName);
		out.print(checkflag);
		out.flush();
		out.close();
	}

}
